#include <stdio.h>
#include <string.h>
// 生日结构体
typedef struct birth
{
    int Y;
    // int M;
} bir;
// 学生结构体
typedef struct student
{
    char name[20];
    int score;
    bir birth;
} stu;

stu find_score(char *name, stu *arr)
{
    stu temp = {0};
    for (int i = 0; i < 2; i++)
    {
        if (strcmp(name, arr[i].name) == 0)
        {
            temp = arr[i];
            break;
        }
    }
    return temp;
}

void show_find(stu res)
{
    printf("输出结果\n");
    printf("姓名:%s\n", res.name);
    printf("成绩:%d\n", res.score);
    printf("生日:%d\n", res.birth.Y);
}
void input_data(stu *arr)
{
    for (int i = 0; i < 2; i++)
    {
        printf("请依次输入姓名 成绩 生日\n");
        scanf("%s %d %d", arr[i].name, &arr[i].score, &arr[i].birth.Y);
        getchar();
    }
}
void main()
{
    stu arr[2] = {'\0'};
    input_data(arr);
    printf("请输入要查找的姓名\n");
    char name[20] = {'\0'};
    scanf("%s", name);
    stu res = find_score(name, arr);
    printf("strlen(name):%lu\n", strlen(res.name));
    if (strlen(res.name) != 0)
    {
        show_find(res);
    }
    else
    {
        printf("查无此人");
    }
}